package com.yq.dayin;

import java.util.Arrays;

/**
 * @author 3307235355@qq.com
 * @description
 * @since 2022/07/04 20:52
 */
/*
（5）编写打印字母的线程LetterPrinter继承Thread类，
声明私有属性private Printer p;在构造方法中进行赋值，
实现父类的run方法，调用Printer类中的输出字母的方法。
 */
public class LetterPrinter extends  Thread {
    private Printer p;
    public LetterPrinter(Printer p) {
        this.p = p;
    }
    @Override
    public void run() {
            // String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            // char[] chars = s.toCharArray();
            // for (int i = 0; i <= chars.length; i++) {
            //         p.print(chars[i]);
            // }
        for (char c = 'A'; c <= 'Z' ; c++) {
            p.print(c);
        }
    }
}

